export default {
    namespaced: true,
    state: {
        //是否显示登录模态框
        isShowToast: false,
        toastMsg: "vuex提示内容",
        //warning提示   success正确   danger错误
        toastType: "warning",
    },
    mutations: {
        //修改登录模态框状态
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.toastType = payload.type;
                state.toastMsg = payload.title;
            }
        }
    },
    actions: {
        asyncShowToast(contxt, payload) {
            contxt.commit("changeIsShowToast", payload);
            setTimeout(() => {
                contxt.commit("changeIsShowToast", {
                    isShow: false,
                });
            }, 2000);
        }

    }
}